package com.xisoft.devise.entity;

import cn.hutool.core.io.resource.ResourceUtil;
import com.xisoft.common.bean.BeanHelper;
import com.xisoft.common.pubEnv.DateUtilbc;
import com.xisoft.common.pubEnv.PropertiesUtil;
import com.xisoft.common.pubEnv.PubEnvUtil;
import lombok.Data;
import org.springframework.core.io.ClassPathResource;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;

/**
 * *
 * Created with Description:
 *
 * @version 1.0 <br>
 * @packagename: com.xisoft.devise.entity<br>
 * @author: LiBencheng <br>
 * @computer: licheng <br>
 * @date: Created on 2022/8/10 11:44 <br>
 */
@Data
public class GenModel
{
    public GenModel( )
    { init(); }

    public void init( )
    {
        try
        {
            String file = "/config/gentemplate.properties";
            Map< String,String > proMap = PropertiesUtil.getAllProInnerJar(file);
            for (Map.Entry< String,String > entry : proMap.entrySet())
            { BeanHelper.setProperty(this, entry.getKey(), entry.getValue()); }
            if (PubEnvUtil.isEmpty(getDate()))
            { setDate(DateUtilbc.currentDateTime()); }
            setPackagePath(PubEnvUtil.isNotEmptyObj(getPackageName()) ?
                                   getPackageName().replace(".", File.separator) : "");
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
    }

    private List< String > setRef;
    private List< String > struct;
    private List< TableColEntity > columnList;
    private List< String > childTables;
    /** 表名 */
    private String tableName;
    /** 实体类名称 */
    private String className;
    /** 功能名 */
    private String tableComments;
    /** 项目包名 */
    private String packageName;
    private String packagePath;
    /** 项目版本号 */
    private String version;
    /** 作者 */
    private String author;
    /** 邮箱 */
    private String email;
    /** 后端生成路径 */
    private String backendPath;
    /** 前端生成路径 */
    private String frontendPath;
    /** 模块名 */
    private String moduleName;
    /** 子模块名 */
    private String subModuleName;
    /** 时间 */
    private String date;

    ////////////////////////////////////////////

    private String pk;
    private String imports;
    private String baseClassEntity;
    private String templateName;


}
